package com.ace.model.bo;

/***********************************************************************
 * Module:  Paiement.java
 * Author:  a.kanwar    
 * Purpose: Defines the Class Paiement
 ***********************************************************************/

import java.util.*;


public class Paiement {
   
   
   /*********************************************************************
    * Attribute
    *********************************************************************/ 
    
   private int idPaiement;
   private float montant;
   private java.util.Date dateEcheance;
   private java.util.Date dateVersement;

    /*********************************************************************
     * Constructor
     *********************************************************************/
    public Paiement(int idPaiement, float montant, Date dateEcheance, Date dateVersement, Collection<Assure> assure, CapitalClient capitalClient, CaisseMutualise caisseMutualise) {
        this.idPaiement = idPaiement;
        this.montant = montant;
        this.dateEcheance = dateEcheance;
        this.dateVersement = dateVersement;
        this.assure = assure;
        this.capitalClient = capitalClient;
        this.caisseMutualise = caisseMutualise;
    }

    public Paiement(float montant, Date dateEcheance, Date dateVersement, Collection<Assure> assure, CapitalClient capitalClient, CaisseMutualise caisseMutualise) {
        this.montant = montant;
        this.dateEcheance = dateEcheance;
        this.dateVersement = dateVersement;
        this.assure = assure;
        this.capitalClient = capitalClient;
        this.caisseMutualise = caisseMutualise;
    }

    /*********************************************************************
     * Getters and setters
     *********************************************************************/
    public int getIdPaiement() {
        return idPaiement;
    }

    public void setIdPaiement(int idPaiement) {
        this.idPaiement = idPaiement;
    }

    public float getMontant() {
        return montant;
    }

    public void setMontant(float montant) {
        this.montant = montant;
    }

    public Date getDateEcheance() {
        return dateEcheance;
    }

    public void setDateEcheance(Date dateEcheance) {
        this.dateEcheance = dateEcheance;
    }

    public Date getDateVersement() {
        return dateVersement;
    }

    public void setDateVersement(Date dateVersement) {
        this.dateVersement = dateVersement;
    }

    @Override
    public String toString() {
        return "Paiement{" + "idPaiement=" + idPaiement + ", montant=" + montant + ", dateEcheance=" + dateEcheance + ", dateVersement=" + dateVersement + ", assure=" + assure + ", capitalClient=" + capitalClient + ", caisseMutualise=" + caisseMutualise + '}';
    }

   
    
    
    
   /*********************************************************************
    * generate code by power AMC
    *********************************************************************/
   public java.util.Collection<Assure> assure;
   /** @pdRoleInfo migr=no name=CapitalClient assc=offre mult=1..1 side=A */
   public CapitalClient capitalClient;
   /** @pdRoleInfo migr=no name=CaisseMutualise assc=donne mult=1..1 side=A */
   public CaisseMutualise caisseMutualise;
   
   
   /** @pdGenerated default getter */
   public java.util.Collection<Assure> getAssure() {
      if (assure == null)
         assure = new java.util.HashSet<Assure>();
      return assure;
   }
   
   /** @pdGenerated default iterator getter */
   public java.util.Iterator getIteratorAssure() {
      if (assure == null)
         assure = new java.util.HashSet<Assure>();
      return assure.iterator();
   }
   
   /** @pdGenerated default setter
     * @param newAssure */
   public void setAssure(java.util.Collection<Assure> newAssure) {
      removeAllAssure();
      for (java.util.Iterator iter = newAssure.iterator(); iter.hasNext();)
         addAssure((Assure)iter.next());
   }
   
   /** @pdGenerated default add
     * @param newAssure */
   public void addAssure(Assure newAssure) {
      if (newAssure == null)
         return;
      if (this.assure == null)
         this.assure = new java.util.HashSet<Assure>();
      if (!this.assure.contains(newAssure))
      {
         this.assure.add(newAssure);
         newAssure.setPaiement(this);      
      }
   }
   
   /** @pdGenerated default remove
     * @param oldAssure */
   public void removeAssure(Assure oldAssure) {
      if (oldAssure == null)
         return;
      if (this.assure != null)
         if (this.assure.contains(oldAssure))
         {
            this.assure.remove(oldAssure);
            oldAssure.setPaiement((Paiement)null);
         }
   }
   
   /** @pdGenerated default removeAll */
   public void removeAllAssure() {
      if (assure != null)
      {
         Assure oldAssure;
         for (java.util.Iterator iter = getIteratorAssure(); iter.hasNext();)
         {
            oldAssure = (Assure)iter.next();
            iter.remove();
            oldAssure.setPaiement((Paiement)null);
         }
      }
   }
   /** @pdGenerated default parent getter */
   public CapitalClient getCapitalClient() {
      return capitalClient;
   }
   
   /** @pdGenerated default parent setter
     * @param newCapitalClient */
   public void setCapitalClient(CapitalClient newCapitalClient) {
      if (this.capitalClient == null || !this.capitalClient.equals(newCapitalClient))
      {
         if (this.capitalClient != null)
         {
            CapitalClient oldCapitalClient = this.capitalClient;
            this.capitalClient = null;
            oldCapitalClient.removePaiement(this);
         }
         if (newCapitalClient != null)
         {
            this.capitalClient = newCapitalClient;
            this.capitalClient.addPaiement(this);
         }
      }
   }
   /** @pdGenerated default parent getter */
   public CaisseMutualise getCaisseMutualise() {
      return caisseMutualise;
   }
   
   /** @pdGenerated default parent setter
     * @param newCaisseMutualise */
   public void setCaisseMutualise(CaisseMutualise newCaisseMutualise) {
      if (this.caisseMutualise == null || !this.caisseMutualise.equals(newCaisseMutualise))
      {
         if (this.caisseMutualise != null)
         {
            CaisseMutualise oldCaisseMutualise = this.caisseMutualise;
            this.caisseMutualise = null;
            oldCaisseMutualise.removePaiement(this);
         }
         if (newCaisseMutualise != null)
         {
            this.caisseMutualise = newCaisseMutualise;
            this.caisseMutualise.addPaiement(this);
         }
      }
   }

}